package com.justech.mes.utils;

/**
 * @author feifei.li
 */
public class NfUtil {
    /**
     * 四舍五入保留两位小数
     *
     * @param d
     * @return
     */
    public static double formatDouble2(double d) {
        return NumberFormatUtil.formatDouble2(d);
    }

    /**
     * float类型四舍五入保留两位小数
     *
     * @param f
     * @return
     */
    public static Float formatFloat2(Float f) {
        return NumberFormatUtil.formatFloat2(f);
    }

    /**
     * 将任意类型四舍五入保留两位小数
     *
     * @param number
     * @return
     */
    public static double round(Object number) {
        if (ObjectUtil.isNull(number)) {
            return 0D;
        }
        return NumberFormatUtil.round(number);
    }

    public static double round(Object number, int digit) {
        return NumberFormatUtil.round(number, digit);
    }

    public static Double convertToDouble(Long l) {
        return NumberFormatUtil.convertToDouble(l);
    }
}
